package com.pp.service.impl;

import com.pp.bean.GovGoodsInfo;
import com.pp.mapper.GovGoodsInfoMapper;
import com.pp.service.GovGoodsImageService;
import com.pp.service.GovGoodsInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pp.util.Respons.ResponseUtil;
import com.pp.util.upload.UploadFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileNotFoundException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author 张子艺
 * @since 2019-04-02
 */
@Service
public class GovGoodsInfoServiceImpl extends ServiceImpl<GovGoodsInfoMapper, GovGoodsInfo> implements GovGoodsInfoService {
    @Autowired
    GovGoodsImageService goodsImageService;
    @Override
    public Map<String, Object> saveGood(GovGoodsInfo govGoodsInfo) {
        if(this.save(govGoodsInfo)){
            if(goodsImageService.updateRelacation(govGoodsInfo.getId(),govGoodsInfo.getIds())>0){
                return ResponseUtil.getSuccessMap();
            };
        }
        return    ResponseUtil.getExceptionMap();
    }

    @Override
    public List<GovGoodsInfo> findGood(GovGoodsInfo govGoodsInfo) {
        return baseMapper.findGood(govGoodsInfo);
    }
}
